<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/wsDangan.css">
    <link rel="stylesheet" href="${request.contextPath}/statics/css/bootstrap.css">

    <!-- 引入组件库 -->
    <script src="${request.contextPath}/statics/js/jquery1.9.1.js"></script>
    <script src="${request.contextPath}/statics/js/echartsmin.js"></script>
    <script src="${request.contextPath}/statics/vue/vue.js"></script>
    <script src="${request.contextPath}/statics/vue/index.js"></script>
    <script src="${request.contextPath}/statics/vue/axios.js"></script>
    <link rel="stylesheet" href="${request.contextPath}/statics/vue/index.css">
    <script src="${request.contextPath}/statics/js/bootstrap.js"></script>
    <script src="${request.contextPath}/statics/js/config.js"></script>
    <script src="${request.contextPath}/statics/js/url-search-params.js"></script>

    <title>首页</title>
</head>
<body class="body">
<div id="app" class="container" v-cloak style="width: 100%;height: 100%;padding: 0px;">
    <#include "danganHeader.html">
    <el-row class="search-container" style="height: 730px;background: #F1F1F1;">
        <el-col :span="1"></el-col>
        <el-col :span="11" style="background: #fff;min-height: 320px;
        padding: 0px 15px;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
            <el-row>
                <el-col :span="2">
                    <div class="v_line_sim ml_10"></div>
                </el-col>
                <el-col :span="10">
                    <div class="font18">档案馆单位基本信息</div>
                </el-col>
                <el-col :span="12"></el-col>
            </el-row>
            <el-row class="mt_5 border_t pt_10">
                <table class="table table-bordered " style="margin-bottom: 0px; ">
                    <tr>
                        <td class="col-md-2" style="width: 20%">单位名称</td>
                        <td colspan="5">宁波市自然资源和规划局</td>
                    </tr>
                    <tr>
                        <td class="col-md-2" style="width: 20%">机构代码</td>
                        <td colspan="5">00294040-X</td>
                    </tr>
                    <tr>
                        <td class="col-md-2" rowspan="3" style="width: 20%">单位负责人</td>
                        <td rowspan="4">孙义为</td>
                    </tr>
                    <tr>
                        <td class="" rowspan="2">职务</td>
                        <td rowspan="3">局长</td>
                    </tr>
                    <tr>
                        <td class="">电话</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="col-md-2" rowspan="3" style="width: 20%">档案主管领导</td>
                        <td rowspan="4">职务</td>
                    </tr>
                    <tr>
                        <td class="col-md-2" rowspan="2">赵恩铭</td>
                        <td rowspan="3">局办公室主任</td>
                    </tr>
                    <tr>
                        <td class="">电话</td>
                        <td>87956020</td>
                    </tr>

                    <tr>
                        <td class="col-md-2" rowspan="3" style="width: 20%">档案室负责人</td>
                        <td rowspan="4">郑铣鑫</td>
                    </tr>
                    <tr>
                        <td class="" rowspan="2">职务</td>
                        <td rowspan="3">主任</td>
                    </tr>
                    <tr>
                        <td class="">电话</td>
                        <td>87956266</td>
                    </tr>
                    <tr>
                        <td class="col-md-2" rowspan="3" style="width: 20%">档案室责任人</td>
                        <td rowspan="4">职务</td>
                    </tr>
                    <tr>
                        <td class="col-md-2" rowspan="2">彭健</td>
                        <td rowspan="3"></td>
                    </tr>
                    <tr>
                        <td class="">电话</td>
                        <td></td>
                    </tr>

                </table>
            </el-row>
        </el-col>
        <el-col :span="11"
                style="background: #fff;min-height: 320px;margin-left: 20px;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)">
            <div id="danganCountInfo" style="min-height: 320px;width: 100%;">
            </div>
        </el-col>
    </el-row>

</div>


</body>
<script type="text/javascript">
    'use strict';
    const http = axios.create({

        baseURL: getUrl(),
        timeout: 100000,
        withCredentials: false, // 是否允许带cookie这些
        // headers: {'Content-Type': 'application/json'}
    });
    var vm = new Vue({
        el: '#app',
        data: {
            loginForm:{
                loginVisible:false,//登录窗口显示
                username:"",
                password:"",
                dialog:false,
                rules:{
                    username:[{required: true,message:'请输入登录名', trigger: 'blur'}],
                    password: [{required: true,message:'请输入密码', trigger: 'blur'}]
                }
            },
            pwdForm:{
                resetPasswordVisible:false,
                oldPassword:'',
                newPassword:'',
                rules:{
                    oldPassword:[{required: true,message:'请输入原密码', trigger: 'blur'}],
                    newPassword: [{required: true,message:'请输入新密码', trigger: 'blur'}]
                },
                showCancel:true,
            },
            username:''

        },
        mounted() {
            this.getLoginInfo()
            this.username=window.localStorage.getItem("username")
            if(window.localStorage.getItem("resetPwd")!=-1){
                if(window.localStorage.getItem("resetPwd")==0){
                    this.pwdForm.showCancel=false
                    this.pwdForm.resetPasswordVisible=true
                }else{
                    this.pwdForm.showCancel=true
                    this.pwdForm.resetPasswordVisible=false
                }
            }
            // this.isLogin()
        },
        methods: {
            getLoginInfo(){
                $.ajax({
                    type: "POST",
                    url: "/danganSys/sys/getLoginInfo",
                    dataType: "json",
                    success: function(result){
                        if(result.code == 0){//登录成功
                            window.localStorage.setItem("login",true)
                            window.localStorage.setItem("user",JSON.stringify(result.user))
                            window.localStorage.setItem("username",result.user.username)
                            this.username=result.user.username
                        }
                    }
                });
            },
            loadHtml(url,flh){
                window.sessionStorage.setItem("flh",flh)
                parent.location.href=url
            },
            search() {
            },
            logout(){
                window.localStorage.clear()
                location.href="/danganSys/logout"
            },
            isLogin(){
                window.localStorage
                var login= window.localStorage.getItem("login")
                console.log("登录状态："+login)
                if(login&&login=="true"){
                    console.log("已登录")
                    this.loginForm.loginVisible=false
                }else{
                    this.$message.error("还未登录")
                    this.loginForm.loginVisible=true
                    console.log("还未登录")
                }
            },
            login(formName){
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        console.log("登录表单验证通过")
                        var data = "?username="+this.loginForm.username+"&password="+this.loginForm.password+"&captcha="+this.loginForm.password
                        http({ method: 'post',
                            url: 'sys/login'+data,
                            headers: {'Content-Type': 'application/json'}
                        }).then(function (result) {
                            if(result.data.code == 0){//登录成功
                                window.localStorage.setItem("login","true")
                                this.loginForm.loginVisible=false
                            }else{
                                window.localStorage.setItem("login","false")
                                this.$message.error(result.data.msg)
                            }
                        }.bind(this)).catch(function (err) {
                            console.error(err)
                        })
                        // http.post('sys/login',params, {
                        //     headers: {'Content-Type': 'application/json'}
                        // })
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },

            resetPassword(){
                this.$refs['pwdForm'].validate((valid) => {
                    if (valid) {
                        console.log("密码修改表单验证通过")
                        if(!CheckPassWord(this.pwdForm.newPassword)){
                            this.$message.error("必须为字母加数字且长度不小于8位")
                        }else{
                            var data = "?password=" + this.pwdForm.oldPassword + "&newPassword=" + this.pwdForm.newPassword
                            http({
                                method: 'post',
                                url: 'sys/user/password' + data,
                                headers: {'Content-Type': 'application/json'}
                            }).then(function (result) {
                                if (result.data.code == 0) {//修改密码成功
                                    this.$message.success("密码修改成功")
                                    this.pwdForm.resetPasswordVisible = false
                                    this.pwdForm.oldPassword=''
                                    this.pwdForm.newPassword=''
                                    this.pwdForm.showCancel=true
                                    window.localStorage.setItem("resetPwd",1)
                                } else {
                                    this.$message.error(result.data.msg)
                                }
                            }.bind(this)).catch(function (err) {
                                console.error(err)
                            })
                        }

                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            }
        }
    })






    var myChart = echarts.init(document.getElementById('danganCountInfo'));
    $.ajax({
        type:"get",
        url:"/danganSys/indexInfo/daCountInfo",
        success:function(data){
            console.info(data);
            // var jsonObject=JSON.parse(data);
            var jsonObject=data["indexInfo"];
            var count=0;
            var myArray=new Array();
            myArray[0]=0;
            var gcwz=new Array();
            var flhs=jsonObject["flhs"];
            console.info(jsonObject["flhs"]);
            var arraySJ=new Array();
            var arrayJB=new Array();
            var arrayHS=new Array();
            var arrayGXQ=new Array();
            var arrayJD=new Array();
            var arrayYZ=new Array();
            arraySJ=jsonObject["市局"];
            arrayHS=jsonObject["海曙"];
            arrayYZ=jsonObject["鄞州"];
            arrayGXQ=jsonObject["高新区"];
            arrayJB=jsonObject["江北"];
            arrayJD=jsonObject["江东"];
            gcwz=jsonObject["gcwz"];
            console.info(flhs[0]);
            /*	var temp=gcwz[1];
                gcwz[1]=gcwz[3];
                gcwz[3]=temp;*/
            var option = {
                title : {
                    text: '市局数字档案馆档案统计',
                    x:'left',
                    textStyle:{
                        fontSize: 20,
                        fontWeight: 'bolder',
                    },

                },
                tooltip : {
                    show: true,
                    trigger: 'axis'
                },
                legend: {
                    show:true,
                    data:gcwz,
                    x:'right'
                },
                toolbox: {
                    show : true,
                    feature : {
                        mark : {show: false},
                        dataView : {show: false, readOnly: false},
                        magicType : {show: false, type: ['line', 'bar', 'stack', 'tiled']},
                        restore : {show: false},
                        saveAsImage : {show: false}
                    }
                },
                calculable : true,
                xAxis : [
                    {
                        type : 'category',
                        boundaryGap : false,
                        data : flhs
                    }
                ],
                yAxis : [
                    {
                        type : 'value',
                        /*max:400000,
                        min:0*/
                    }
                ],
                series : [

                    {
                        name:gcwz[0],
                        type:'line',
                        data:arraySJ,
                    },
                    {
                        name:gcwz[1],
                        type:'line',
                        data:arrayHS,
                    },
                    {
                        name:gcwz[2],
                        type:'line',
                        data:arrayYZ,
                    },
                    {
                        name:gcwz[3],
                        type:'line',
                        data:arrayGXQ,
                    },
                    {
                        name:gcwz[4],
                        type:'line',
                        data:arrayJB,
                    },
                    {
                        name:gcwz[5],
                        type:'line',
                        data:arrayJD,
                    }
                ]
            };

            // 为echarts对象加载数据
            myChart.setOption(option);
        }
    });
</script>

</html>



